package com.smbms.service.user;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.smbms.dao.user.UserMapper;
import com.smbms.entity.User;
@Service("userService")
public class UserServiceImpl implements UserService{
	
	
	@Resource
	private UserMapper userMapper;
	
	/**
	 * 登录
	 */
	@Override
	public User login(String userCode) {
		User user = userMapper.login(userCode);
		return user;
	}

	@Override
	public int count(String queryname, int userRole) {
		
		return userMapper.count(queryname, userRole);
	}

	@Override
	public List<User> getUserList(String queryname, int userRole, int currentNo, int pageSize) {
		return userMapper.getUserList(queryname, userRole, currentNo, pageSize);
	}

	@Override
	public User getUserById(int id) {
		return userMapper.getUserById(id);
	}

	@Override
	public boolean deleteUser(int id) {
		if(userMapper.deleteUser(id)>0){
			return true;
		}
		return false;
	}

	@Override
	public boolean addUser(User user) {
		if(userMapper.addUser(user)>0){
			return true;
		}
		return false;
	}

	@Override
	public boolean updateUser(User user) {
		if(userMapper.updateUser(user)>0){
			return true;
		}
		return false;
	}

	@Override
	public User selectUserCodeExist(String userCode) {
		return userMapper.selectUserCodeExist(userCode);
	}

	@Override
	public List<User> download(String queryname, int userRole) {
		return userMapper.download(queryname, userRole);
	}

}
